import {createStore} from 'vuex';

export default createStore({
    state: {
        imageCode: {
            new: [],
            old: []
        }
    },
    mutations: {
        appendImageCode(state, payload) {
            if (payload.new && payload.new.length > 0) {
                state.imageCode.new.push(...payload.new);
            }
            if (payload.old && payload.old.length > 0) {
                state.imageCode.old.push(...payload.old);
            }
        },
        removeImageCode(state, payload) {
            state.imageCode.new = state.imageCode.new.filter(item => !payload.new.includes(item));
            state.imageCode.old = state.imageCode.old.filter(item => !payload.old.includes(item));
        },
        removeAllImageCode(state, payload) {
            state.imageCode.new = [];
            state.imageCode.old = [];
        }
    },
    actions: {
        // ... existing actions ...
    },
    getters: {
        //
    }
});